Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
spotify-uri
Advanced tools
Spotify URIs get passed around in a variety of flavors. This module parses them into a JavaScript object so you can work with them further. You can also convert them back into Spotify URIs or HTTP URLs.
Install for node.js or browserify using npm
:
$ npm install spotify-uri
var spotifyUri = require('spotify-uri');
var parsed, uri;
// parse Spotify URIs or HTTP URLs into JavaScipt metadata Objects:
parsed = spotifyUri.parse('spotify:track:3GU4cxkfdc3lIp9pFEMMmw');
console.log(parsed);
// { uri: 'spotify:track:3GU4cxkfdc3lIp9pFEMMmw',
// type: 'track',
// id: '3GU4cxkfdc3lIp9pFEMMmw' }
parsed = spotifyUri.parse('http://open.spotify.com/track/1pKYYY0dkg23sQQXi0Q5zN');
console.log(parsed);
// { uri: 'http://open.spotify.com/track/1pKYYY0dkg23sQQXi0Q5zN',
// type: 'track',
// id: '1pKYYY0dkg23sQQXi0Q5zN' }
// you can also format the parsed objects back into a URI or HTTP URL:
uri = spotifyUri.formatURI(parsed);
console.log(uri);
// 'spotify:track:1pKYYY0dkg23sQQXi0Q5zN'
uri = spotifyUri.formatOpenURL(parsed);
console.log(uri);
// 'http://open.spotify.com/track/1pKYYY0dkg23sQQXi0Q5zN'
uri = spotifyUri.formatPlayURL(parsed);
console.log(uri);
// 'https://play.spotify.com/track/1pKYYY0dkg23sQQXi0Q5zN'
uri = spotifyUri.formatEmbedURL(parsed);
console.log(uri);
// 'https://embed.spotify.com/?uri=spotify:track:1pKYYY0dkg23sQQXi0Q5zN'
See the test cases for some more examples of Spotify URIs.
Parses a Spotify URI or a Spotify HTTP(s) URL into an Object. The specific
properties set on the returned Object depend on the "type" of uri
that gets
passed in. The different "types" are listed below:
Formats a parsed URI Object back into a Spotify URI. For example:
var parsed = spotifyUri.parse('https://play.spotify.com/track/3GU4cxkfdc3lIp9pFEMMmw');
var uri = spotifyUri.formatURI(parsed);
console.log(uri);
// 'spotify:track:3GU4cxkfdc3lIp9pFEMMmw'
Formats a parsed URI Object back into a Spotify HTTP "open" URL. For example:
var parsed = spotifyUri.parse('spotify:track:3c1zC1Ma3987kQcHQfcG0Q');
var uri = spotifyUri.formatOpenURL(parsed);
console.log(uri);
// 'http://open.spotify.com/track/3c1zC1Ma3987kQcHQfcG0Q'
Formats a parsed URI Object back into a Spotify HTTPS "play" URL. For example:
var parsed = spotifyUri.parse('spotify:track:4Jgp57InfWE4MxJLfheNVz');
var uri = spotifyUri.formatPlayURL(parsed);
console.log(uri);
// 'https://play.spotify.com/track/4Jgp57InfWE4MxJLfheNVz'
Formats a parsed URI Object back into a Spotify HTTPS "embed" URL. For example:
var parsed = spotifyUri.parse('spotify:track:6JmI8SpUHoQ4yveHLjTrko');
var uri = spotifyUri.formatEmbedURL(parsed);
console.log(uri);
// 'https://embed.spotify.com/?uri=spotify:track:6JmI8SpUHoQ4yveHLjTrko'
MIT
FAQs
Parse the various Spotify URI formats into Objects and back
The npm package spotify-uri receives a total of 8,715 weekly downloads. As such, spotify-uri popularity was classified as popular.
We found that spotify-uri demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.